﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class student_resetpwd : System.Web.UI.Page
{
    protected Student  stu;
    protected void Page_Load(object sender, EventArgs e)
    {
        stu = Student.Check();
        if (stu == null)
        {
            Session.Add(Params.SystemError, "请先登录");
            Response.Redirect(Params.RootHttp + "default.aspx");
        }
        if (!Page.IsPostBack)
        {
            this.MyDataBind();
        }
    }

    public void MyDataBind()
    {
        this.Title = this.stu.RealName + "-修改密码";
        this.conNav.Title = "修改密码";
    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        string pwd1 = this.tbPwd.Text;
        string pwd2 = this.tbConfirm.Text;
        if (pwd1 == "")
        {
            this.info.SetMessage("新密码不能为空！");
            return;
        }
        if (pwd1 != pwd2)
        {
            this.info.SetMessage("两次密码输入不一致！");
            return;
        }
        this.stu.Password = pwd1;
        this.stu.Update();
        this.info.SetMessage("修改成功！");
    }
}
